/**
 * 功能描述 行编辑触发事件
 */
define(function (require, exports, module) {
	var store = require("store");
	var activeUser = store.get("user");
	var nonmemSvc = require("../store/nonmemSvc");
	var Dialog=require("dialog");
	
    module.exports = {
    	saveAction : function(data,widget){
    		nonmemSvc.saveSignup(widget, data,function(datas){
    			Dialog.alert({
    				content:"保存成功"
            	});
    			
    			widget.show([".J-form", ".J-pergrid"]).hide(".J-perform");
    			if(widget.get("type") == "NonMember"){
    				widget.get("subnav").show(["save", "return"]).hide(["startDate","servicePoint","status"]);
    			}else{
    				widget.get("subnav").show(["save", "return"]).hide(["operateDate","status"]);
    			}
				widget.get("perform").reset();
				var gridData = widget.get("pergrid").getData();
				var nonMemSignUpData = {
					signUpRegister : datas[0]
				}
				gridData.push(nonMemSignUpData);
				widget.get("pergrid").setData(gridData);
				var gridData2 = widget.get("pergrid").getData();
				widget.get("form").setValue("signUpNumber",gridData2.length);
				var tourType = widget.get("form").getValue("tourType");
				if(tourType == "IndivMember"){
					$(".J-grid-columns-signUpRegister-travelContract-memberCertificates").removeClass("hidden");
				}else{
					$(".J-grid-columns-signUpRegister-travelContract-memberCertificates").addClass("hidden");
				}
//				widget.get("pergrid").refresh(null,function(data){
//					widget.get("form").setValue("signUpNumber",data.length);	
//				});
    		});
        }
    };
});
